<?PHP
	require 'includes/master.inc.php';
	$auth->admin();

	$a = new App();
	$apps = $a->glob();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Appcaster</title>
	<?PHP include 'inc/meta.inc.php'; ?>
</head>

<body id="home">
	<?PHP include 'inc/head.inc.php'; ?>
	<div id="nav">
		<ul>
			<li class='selected'><a href='<?PHP WEBROOT();?>'>Applications</a></li>
			<li><a href='<?PHP WEBROOT();?>orders.php'>Orders</a></li>
			<li><a href='<?PHP WEBROOT();?>feedback.php'>Feedback (<?PHP echo Feedback::newCountTotal();?>)</a></li>
			<li><a href='<?PHP WEBROOT();?>stats.php'>Stats</a></li>
			<li><a href='<?PHP WEBROOT();?>options.php'>Options</a></li>
		</ul>
	</div>

	<div id="menutabs">
		<ul id="tabnav">
			<li class='selected'><a href='<?PHP WEBROOT();?>'>Application List</a></li>
			<li><a href='<?PHP WEBROOT();?>newapp.php'>New App</a></li>
		</ul>
	</div>

	<div id="contain">
		<table class="grid">
			<tr>
				<th>App Name</th>
				<th>Current Version</th>
				<th>Last Release</th>
				<th>Support Questions</th>
				<th>Bug Reports</th>
				<th>Feature Requests</th>
			</tr>
			<?PHP foreach($apps as $app) : ?>
			<tr>
				<td><a href="<?PHP WEBROOT();?>appcast.php?app_id=<?PHP echo $app->id;?>"><img src='<?PHP WEBROOT();?>images/feed-icon-14x14.png' /></a> <a href='<?PHP WEBROOT();?>editapp.php?app_id=<?PHP echo $app->id;?>'><?PHP echo $app->name; ?></a></td>
				<td><?PHP echo $app->currentVersion();?></td>
				<td><?PHP echo dater("n/d/Y g:ia", $app->lastRelease());?></td>
				<td class='c'><a href="feedback.php?type=support&amp;app_id=<?PHP echo $app->id;?>"><?PHP echo $app->numQuestions();?></a></td>
				<td class='c'><a href="feedback.php?type=bug&amp;app_id=<?PHP echo $app->id;?>"><?PHP echo $app->numBugs();?></a></td>
				<td class='c'><a href="feedback.php?type=feature&ammp;app_id=<?PHP echo $app->id;?>"><?PHP echo $app->numFeatures();?></a></td>
			</tr>			
			<?PHP endforeach; ?>
		</table>
		<!-- <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a></p> -->
	</div>
</body>
</html>